
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for oauth2_authorization
-- ----------------------------
DROP TABLE IF EXISTS `oauth2_authorization`;
CREATE TABLE `oauth2_authorization` (
  `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `registered_client_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `principal_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `authorization_grant_type` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `authorized_scopes` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `attributes` blob,
  `state` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `authorization_code_value` blob,
  `authorization_code_issued_at` timestamp NULL DEFAULT NULL,
  `authorization_code_expires_at` timestamp NULL DEFAULT NULL,
  `authorization_code_metadata` blob,
  `access_token_value` blob,
  `access_token_issued_at` timestamp NULL DEFAULT NULL,
  `access_token_expires_at` timestamp NULL DEFAULT NULL,
  `access_token_metadata` blob,
  `access_token_type` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `access_token_scopes` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `oidc_id_token_value` blob,
  `oidc_id_token_issued_at` timestamp NULL DEFAULT NULL,
  `oidc_id_token_expires_at` timestamp NULL DEFAULT NULL,
  `oidc_id_token_metadata` blob,
  `refresh_token_value` blob,
  `refresh_token_issued_at` timestamp NULL DEFAULT NULL,
  `refresh_token_expires_at` timestamp NULL DEFAULT NULL,
  `refresh_token_metadata` blob,
  `user_code_value` blob,
  `user_code_issued_at` timestamp NULL DEFAULT NULL,
  `user_code_expires_at` timestamp NULL DEFAULT NULL,
  `user_code_metadata` blob,
  `device_code_value` blob,
  `device_code_issued_at` timestamp NULL DEFAULT NULL,
  `device_code_expires_at` timestamp NULL DEFAULT NULL,
  `device_code_metadata` blob,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of oauth2_authorization
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for oauth2_authorization_consent
-- ----------------------------
DROP TABLE IF EXISTS `oauth2_authorization_consent`;
CREATE TABLE `oauth2_authorization_consent` (
  `registered_client_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `principal_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `authorities` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`registered_client_id`,`principal_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of oauth2_authorization_consent
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for oauth2_registered_client
-- ----------------------------
DROP TABLE IF EXISTS `oauth2_registered_client`;
CREATE TABLE `oauth2_registered_client` (
  `id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_id` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_id_issued_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `client_secret` varchar(200) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `client_secret_expires_at` timestamp NULL DEFAULT NULL,
  `client_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_authentication_methods` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `authorization_grant_types` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `redirect_uris` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `post_logout_redirect_uris` varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `scopes` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `client_settings` varchar(2000) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token_settings` varchar(2000) COLLATE utf8mb4_unicode_ci NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- ----------------------------
-- Records of oauth2_registered_client
-- ----------------------------
BEGIN;
INSERT INTO `oauth2_registered_client` (`id`, `client_id`, `client_id_issued_at`, `client_secret`, `client_secret_expires_at`, `client_name`, `client_authentication_methods`, `authorization_grant_types`, `redirect_uris`, `post_logout_redirect_uris`, `scopes`, `client_settings`, `token_settings`) VALUES ('3eacac0e-0de9-4727-9a64-6bdd4be2ee1f', 'hiauth-server', '2023-07-12 07:33:42', '$2a$10$.J0Rfg7y2Mu8AN8Dk2vL.eBFa9NGbOYCPOAFEw.QhgGLVXjO7eFDC', NULL, 'hiauth-server', 'client_secret_basic,client_secret_post', 'refresh_token,authorization_code,client_credentials,password', 'http://hiauth:9000/login/oauth2/code/authorization-code,http://www.baidu.com', 'http://127.0.0.1:8080/', 'openid,profile,user', '{\"@class\":\"java.util.Collections$UnmodifiableMap\",\"settings.client.require-proof-key\":false,\"settings.client.require-authorization-consent\":true}', '{\"@class\":\"java.util.Collections$UnmodifiableMap\",\"settings.token.reuse-refresh-tokens\":true,\"settings.token.id-token-signature-algorithm\":[\"org.springframework.security.oauth2.jose.jws.SignatureAlgorithm\",\"RS256\"],\"settings.token.access-token-time-to-live\":[\"java.time.Duration\",300.000000000],\"settings.token.access-token-format\":{\"@class\":\"org.springframework.security.oauth2.server.authorization.settings.OAuth2TokenFormat\",\"value\":\"self-contained\"},\"settings.token.refresh-token-time-to-live\":[\"java.time.Duration\",3600.000000000],\"settings.token.authorization-code-time-to-live\":[\"java.time.Duration\",300.000000000],\"settings.token.device-code-time-to-live\":[\"java.time.Duration\",300.000000000]}');
INSERT INTO `oauth2_registered_client` (`id`, `client_id`, `client_id_issued_at`, `client_secret`, `client_secret_expires_at`, `client_name`, `client_authentication_methods`, `authorization_grant_types`, `redirect_uris`, `post_logout_redirect_uris`, `scopes`, `client_settings`, `token_settings`) VALUES ('aaaa-vvvv', 'himall', '2023-07-12 07:33:42', '$2a$10$.J0Rfg7y2Mu8AN8Dk2vL.eBFa9NGbOYCPOAFEw.QhgGLVXjO7eFDC', NULL, 'himall', 'client_secret_basic,client_secret_post', 'refresh_token,authorization_code,client_credentials,password', 'http://himall:9001/login/oauth2/code/authorization-code,http://127.0.0.1:9001/login/oauth2/code/authorization-code,http://www.baidu.com', 'http://127.0.0.1:8080/', 'openid,profile,user', '{\"@class\":\"java.util.Collections$UnmodifiableMap\",\"settings.client.require-proof-key\":false,\"settings.client.require-authorization-consent\":true}', '{\"@class\":\"java.util.Collections$UnmodifiableMap\",\"settings.token.reuse-refresh-tokens\":true,\"settings.token.id-token-signature-algorithm\":[\"org.springframework.security.oauth2.jose.jws.SignatureAlgorithm\",\"RS256\"],\"settings.token.access-token-time-to-live\":[\"java.time.Duration\",300.000000000],\"settings.token.access-token-format\":{\"@class\":\"org.springframework.security.oauth2.server.authorization.settings.OAuth2TokenFormat\",\"value\":\"self-contained\"},\"settings.token.refresh-token-time-to-live\":[\"java.time.Duration\",3600.000000000],\"settings.token.authorization-code-time-to-live\":[\"java.time.Duration\",300.000000000],\"settings.token.device-code-time-to-live\":[\"java.time.Duration\",300.000000000]}');
COMMIT;

-- ----------------------------
-- Table structure for t_config
-- ----------------------------
DROP TABLE IF EXISTS `t_config`;
CREATE TABLE `t_config` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT '租户id',
  `pcode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '父键',
  `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键',
  `val` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '值',
  `title` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
  `remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `updater` bigint DEFAULT NULL COMMENT '更新人',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_cid_key` (`cid`,`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='租户配置';

-- ----------------------------
-- Records of t_config
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_corp
-- ----------------------------
DROP TABLE IF EXISTS `t_corp`;
CREATE TABLE `t_corp` (
  `id` bigint NOT NULL COMMENT '主键',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称',
  `status` int NOT NULL DEFAULT '1' COMMENT '状态，1：正常',
  `creator` bigint DEFAULT NULL COMMENT '创建人',
  `updater` bigint DEFAULT NULL COMMENT '更新人',
  `deleter` bigint DEFAULT NULL COMMENT '删除人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_time` datetime DEFAULT NULL COMMENT '删除时间',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='租户';

-- ----------------------------
-- Records of t_corp
-- ----------------------------
BEGIN;
INSERT INTO `t_corp` (`id`, `name`, `status`, `creator`, `updater`, `deleter`, `create_time`, `update_time`, `delete_time`, `is_deleted`) VALUES (1, '北斯塔科技', 1, NULL, NULL, NULL, '2024-06-27 01:58:58', '2024-06-27 02:06:32', NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for t_dep_emp
-- ----------------------------
DROP TABLE IF EXISTS `t_dep_emp`;
CREATE TABLE `t_dep_emp` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT '租户id',
  `dep_id` bigint NOT NULL COMMENT '部门',
  `emp_id` bigint NOT NULL COMMENT '员工',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_dep_emp` (`dep_id`,`emp_id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='部门员工关系';

-- ----------------------------
-- Records of t_dep_emp
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_department
-- ----------------------------
DROP TABLE IF EXISTS `t_department`;
CREATE TABLE `t_department` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT '租户id',
  `pid` bigint DEFAULT NULL COMMENT '父部门',
  `sort` int NOT NULL DEFAULT '0' COMMENT '排序号',
  `no` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '部门编码',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '部门名称',
  `creator` bigint DEFAULT NULL COMMENT '创建人',
  `updater` bigint DEFAULT NULL COMMENT '更新人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `status` int NOT NULL DEFAULT '1' COMMENT '状态，0：禁用，1：启用',
  `remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='部门';

-- ----------------------------
-- Records of t_department
-- ----------------------------
BEGIN;
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (1, 1, NULL, 1, 'B001', '北斯塔科技', NULL, NULL, '2024-06-27 02:02:56', '2024-07-08 07:12:30', 1, '11');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (2, 1, 1, 2, 'B002', '华东子公司', NULL, NULL, '2024-07-05 09:51:31', '2024-07-08 07:12:33', 1, '22');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (3, 1, 1, 3, 'B003', '华北子公司', NULL, NULL, '2024-07-05 09:51:40', '2024-07-08 07:12:36', 1, '33');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (21, 1, 2, 4, 'B004', '研发中心', NULL, NULL, '2024-07-05 09:52:10', '2024-07-08 07:12:39', 1, '44');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (22, 1, 2, 5, 'B005', '销售中心', NULL, NULL, '2024-07-05 09:52:24', '2024-07-08 07:12:43', 1, '55');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (31, 1, 3, 6, 'B006', '销售中心', NULL, NULL, '2024-07-05 09:52:35', '2024-07-08 07:12:45', 1, '66');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (211, 1, 21, 7, 'B007', '大数据研发', NULL, NULL, '2024-07-05 09:53:38', '2024-07-08 07:12:49', 1, '77');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (1810262124264361984, 1, 1820219676079124481, 0, '333', '3333', NULL, NULL, '2024-07-08 10:38:18', '2024-07-08 10:38:18', 1, '33');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (1810262300429324288, 1, 1810262124264361984, 0, '444', '444', NULL, NULL, '2024-07-08 10:39:00', '2024-07-08 10:39:00', 1, '44');
INSERT INTO `t_department` (`id`, `cid`, `pid`, `sort`, `no`, `name`, `creator`, `updater`, `create_time`, `update_time`, `status`, `remark`) VALUES (1820219676079124481, 1, 1, 0, 'X1', 'ddd', NULL, NULL, '2024-07-08 07:49:37', '2024-07-08 10:36:24', 1, '333');
COMMIT;

-- ----------------------------
-- Table structure for t_emp_role
-- ----------------------------
DROP TABLE IF EXISTS `t_emp_role`;
CREATE TABLE `t_emp_role` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT '租户id',
  `emp_id` bigint NOT NULL COMMENT '员工',
  `role_id` bigint NOT NULL COMMENT '角色',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_emp_role` (`emp_id`,`role_id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='员工角色关系';

-- ----------------------------
-- Records of t_emp_role
-- ----------------------------
BEGIN;
INSERT INTO `t_emp_role` (`id`, `cid`, `emp_id`, `role_id`) VALUES (1, 1, 1, 1);
COMMIT;

-- ----------------------------
-- Table structure for t_employee
-- ----------------------------
DROP TABLE IF EXISTS `t_employee`;
CREATE TABLE `t_employee` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT '租户ID',
  `user_id` bigint NOT NULL COMMENT '用户id',
  `dep_id` bigint NOT NULL COMMENT '部门id',
  `no` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '员工号',
  `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '姓名',
  `email` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '邮箱',
  `creator` bigint DEFAULT NULL COMMENT '创建人',
  `updater` bigint DEFAULT NULL COMMENT '更新人',
  `deleter` bigint DEFAULT NULL COMMENT '删除人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_time` datetime DEFAULT NULL COMMENT '删除时间',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='员工';

-- ----------------------------
-- Records of t_employee
-- ----------------------------
BEGIN;
INSERT INTO `t_employee` (`id`, `cid`, `user_id`, `dep_id`, `no`, `name`, `email`, `creator`, `updater`, `deleter`, `create_time`, `update_time`, `delete_time`, `is_deleted`) VALUES (1, 1, 1, 1, 'NO001', '管理员', NULL, NULL, NULL, NULL, '2024-06-27 02:06:12', '2024-06-27 02:06:12', NULL, 0);
COMMIT;

-- ----------------------------
-- Table structure for t_log
-- ----------------------------
DROP TABLE IF EXISTS `t_log`;
CREATE TABLE `t_log` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT '租户id',
  `actor` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '事件触发者',
  `actor_ip` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '触发者ip',
  `actor_type` int NOT NULL COMMENT '触发者类型，1：系统，2：员工，3：用户',
  `event_time` datetime NOT NULL COMMENT '事件产生时间',
  `event_desc` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '事件描述',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='租户日志';

-- ----------------------------
-- Records of t_log
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_message
-- ----------------------------
DROP TABLE IF EXISTS `t_message`;
CREATE TABLE `t_message` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT '租户',
  `type` int NOT NULL DEFAULT '1' COMMENT '消息类型 1：系统消息',
  `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
  `content` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '内容',
  `ref_type` int NOT NULL COMMENT '长引用类型',
  `ref_id` bigint NOT NULL COMMENT '长引用id',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='消息';

-- ----------------------------
-- Records of t_message
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_msg_emp
-- ----------------------------
DROP TABLE IF EXISTS `t_msg_emp`;
CREATE TABLE `t_msg_emp` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT '租户id',
  `emp_id` bigint NOT NULL COMMENT '员工',
  `msg_id` bigint NOT NULL COMMENT '消息',
  `is_read` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已读，0：未读，1：已读',
  `read_time` datetime DEFAULT NULL COMMENT '读取时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_emp_msg` (`emp_id`,`msg_id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='消息员工关系';

-- ----------------------------
-- Records of t_msg_emp
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_role
-- ----------------------------
DROP TABLE IF EXISTS `t_role`;
CREATE TABLE `t_role` (
  `id` bigint NOT NULL COMMENT '主键',
  `cid` bigint NOT NULL COMMENT 'cid',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称',
  `remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `resource_ids` json DEFAULT NULL COMMENT '权限资源',
  `creator` bigint DEFAULT NULL COMMENT '创建人',
  `updater` bigint DEFAULT NULL COMMENT '更新人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `is_enable` tinyint(1) NOT NULL DEFAULT '1' COMMENT '是否可用',
  PRIMARY KEY (`id`),
  KEY `idx_cid` (`cid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='角色';

-- ----------------------------
-- Records of t_role
-- ----------------------------
BEGIN;
INSERT INTO `t_role` (`id`, `cid`, `name`, `remark`, `resource_ids`, `creator`, `updater`, `create_time`, `update_time`, `is_enable`) VALUES (1, 1, '管理员', NULL, '[300, 301, 500, 501, 502]', NULL, NULL, '2024-06-27 02:07:04', '2024-07-04 05:27:41', 1);
COMMIT;

-- ----------------------------
-- Table structure for t_sys_config
-- ----------------------------
DROP TABLE IF EXISTS `t_sys_config`;
CREATE TABLE `t_sys_config` (
  `id` bigint NOT NULL COMMENT '主键',
  `pcode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '父键',
  `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键',
  `val` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '值',
  `title` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '标题',
  `remark` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  `creator` bigint DEFAULT NULL COMMENT '创建人',
  `updater` bigint DEFAULT NULL COMMENT '更新人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_key` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统级配置';

-- ----------------------------
-- Records of t_sys_config
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_sys_dict
-- ----------------------------
DROP TABLE IF EXISTS `t_sys_dict`;
CREATE TABLE `t_sys_dict` (
  `id` bigint NOT NULL COMMENT '主键',
  `pcode` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '父键',
  `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '键',
  `val` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '值',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称',
  `sort` int DEFAULT NULL COMMENT '排序',
  PRIMARY KEY (`id`),
  KEY `uk_key` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='字典';

-- ----------------------------
-- Records of t_sys_dict
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_sys_log
-- ----------------------------
DROP TABLE IF EXISTS `t_sys_log`;
CREATE TABLE `t_sys_log` (
  `id` bigint NOT NULL COMMENT '主键',
  `actor` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '事件触发者',
  `actor_ip` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '触发者ip',
  `actor_type` int NOT NULL COMMENT '触发者类型，1：系统，2：员工，3：用户',
  `event_time` datetime NOT NULL COMMENT '事件产生时间',
  `event_desc` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '事件描述',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统日志';

-- ----------------------------
-- Records of t_sys_log
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for t_sys_resource
-- ----------------------------
DROP TABLE IF EXISTS `t_sys_resource`;
CREATE TABLE `t_sys_resource` (
  `id` bigint NOT NULL COMMENT '主键',
  `pcode` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '父编码',
  `code` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '编码',
  `url` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'URL',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称',
  `type` int NOT NULL COMMENT '资源类型，1：目录、菜单，2：页面，3：功能、接口',
  `remark` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE KEY `uk_code` (`code`),
  UNIQUE KEY `uk_url` (`url`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='系统资源';

-- ----------------------------
-- Records of t_sys_resource
-- ----------------------------
BEGIN;
INSERT INTO `t_sys_resource` (`id`, `pcode`, `code`, `url`, `name`, `type`, `remark`) VALUES (300, NULL, 'guide', NULL, '引用', 1, NULL);
INSERT INTO `t_sys_resource` (`id`, `pcode`, `code`, `url`, `name`, `type`, `remark`) VALUES (301, 'guide', 'guide:index', NULL, '引用Demo', 2, NULL);
INSERT INTO `t_sys_resource` (`id`, `pcode`, `code`, `url`, `name`, `type`, `remark`) VALUES (500, NULL, 'function', NULL, '功能', 1, NULL);
INSERT INTO `t_sys_resource` (`id`, `pcode`, `code`, `url`, `name`, `type`, `remark`) VALUES (501, 'function', 'function:multiple-tabs', NULL, '多开标签', 2, NULL);
INSERT INTO `t_sys_resource` (`id`, `pcode`, `code`, `url`, `name`, `type`, `remark`) VALUES (502, 'function', 'function:request', NULL, '请求', 2, NULL);
COMMIT;

-- ----------------------------
-- Table structure for t_user
-- ----------------------------
DROP TABLE IF EXISTS `t_user`;
CREATE TABLE `t_user` (
  `id` bigint NOT NULL COMMENT '主键',
  `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '名称',
  `gender` int NOT NULL DEFAULT '0' COMMENT '性别，0：未知，1：男，2：女',
  `avatar_url` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '头像',
  `phone_num` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '手机号码',
  `username` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名',
  `pwd` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
  `status` int NOT NULL DEFAULT '1' COMMENT '状态，1：正常',
  `regtime` datetime NOT NULL COMMENT '注册时间',
  `last_login_time` datetime DEFAULT NULL COMMENT '最后登录时间',
  `creator` bigint DEFAULT NULL COMMENT '创建人',
  `updater` bigint DEFAULT NULL COMMENT '更新人',
  `deleter` bigint DEFAULT NULL COMMENT '删除人',
  `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `delete_time` datetime DEFAULT NULL COMMENT '删除时间',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已删除',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_username` (`username`),
  UNIQUE KEY `uk_phone_num` (`username`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='用户';

-- ----------------------------
-- Records of t_user
-- ----------------------------
BEGIN;
INSERT INTO `t_user` (`id`, `name`, `gender`, `avatar_url`, `phone_num`, `username`, `pwd`, `status`, `regtime`, `last_login_time`, `creator`, `updater`, `deleter`, `create_time`, `update_time`, `delete_time`, `is_deleted`) VALUES (1, '管理员', 0, NULL, '13712345678', 'admin', '$2a$10$8fyY0WbNAr980e6nLcPL5ugmpkLLH3serye5SJ3UcDForTW5b0Sx.', 1, '2024-06-27 10:01:05', NULL, NULL, NULL, NULL, '2024-06-27 02:01:08', '2024-07-12 07:04:55', NULL, 0);
INSERT INTO `t_user` (`id`, `name`, `gender`, `avatar_url`, `phone_num`, `username`, `pwd`, `status`, `regtime`, `last_login_time`, `creator`, `updater`, `deleter`, `create_time`, `update_time`, `delete_time`, `is_deleted`) VALUES (2, '22', 0, NULL, '22', '22', '{bcrypt}$2a$10$9gDJ8GHNRe48HoLZAD7jKutznE4sJ9JW37eo7yQSZwGw0KLmFTn9O', 1, '2024-06-28 16:29:14', NULL, NULL, NULL, NULL, '2024-06-28 08:29:18', '2024-07-12 07:04:40', NULL, 0);
INSERT INTO `t_user` (`id`, `name`, `gender`, `avatar_url`, `phone_num`, `username`, `pwd`, `status`, `regtime`, `last_login_time`, `creator`, `updater`, `deleter`, `create_time`, `update_time`, `delete_time`, `is_deleted`) VALUES (1807588135591092224, '111', 0, NULL, NULL, '49x', '{bcrypt}$2a$10$9gDJ8GHNRe48HoLZAD7jKutznE4sJ9JW37eo7yQSZwGw0KLmFTn9O', 1, '2024-07-01 09:32:50', NULL, NULL, NULL, NULL, '2024-07-01 01:32:49', '2024-07-12 07:04:43', NULL, 0);
INSERT INTO `t_user` (`id`, `name`, `gender`, `avatar_url`, `phone_num`, `username`, `pwd`, `status`, `regtime`, `last_login_time`, `creator`, `updater`, `deleter`, `create_time`, `update_time`, `delete_time`, `is_deleted`) VALUES (1807611516482936832, '111', 0, NULL, NULL, '43x', 'sdssss', 1, '2024-07-01 11:05:44', NULL, NULL, NULL, NULL, '2024-07-01 03:05:44', '2024-07-01 03:05:44', NULL, 0);
INSERT INTO `t_user` (`id`, `name`, `gender`, `avatar_url`, `phone_num`, `username`, `pwd`, `status`, `regtime`, `last_login_time`, `creator`, `updater`, `deleter`, `create_time`, `update_time`, `delete_time`, `is_deleted`) VALUES (1807615667329699840, '111', 0, NULL, NULL, '13x', 'sdssss', 1, '2024-07-01 11:22:14', NULL, NULL, NULL, NULL, '2024-07-01 03:22:13', '2024-07-01 03:22:13', NULL, 0);
INSERT INTO `t_user` (`id`, `name`, `gender`, `avatar_url`, `phone_num`, `username`, `pwd`, `status`, `regtime`, `last_login_time`, `creator`, `updater`, `deleter`, `create_time`, `update_time`, `delete_time`, `is_deleted`) VALUES (1808062478523772928, '111', 0, NULL, NULL, '41x', 'sdssss', 1, '2024-07-02 16:57:42', NULL, NULL, NULL, NULL, '2024-07-02 08:57:41', '2024-07-02 08:57:41', NULL, 0);
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
